from datetime import datetime

def generate_string():
    count = 0
    while True:
        current_time = datetime.now().strftime("%Y%m%d%H%M%S")
        yield "02HD{}{:03d}".format(current_time, count)
        count = (count + 1) % 1000

# 测试生成器
string_generator = generate_string()

# 打印前十个值
for _ in range(10):
    print(next(string_generator))